<?php
/**
 * @特惠赚
 * Author: 小谢
 * Date: 2019-5-9
 */
namespace app\api\validate;

use think\Validate;

/**
 * Description of User
 *
 * @author Xiaoxie
 */
class User extends Validate
{
    //验证规则
    protected $rule = [
        'mobile'    =>'require|checkMobile',
        'password'  =>'require',
    ];

    //错误信息
    protected $message  = [
        'mobile.require'        => '0:手机号码不能为空',
        'mobile.checkMobile'          => '0:手机号码格式错误',
        'password.require'        => '0:密码不能为空',
    ];
    /**
     * 检查手机格式
     * @param $value|验证数据
     * @param $rule|验证规则
     * @param $data|全部数据
     * @return bool|string
     */
    protected function checkMobile($value, $rule ,$data)
    {
        return check_mobile($value);
    }
    
}
